﻿Public Class frmConsultaLaudo
    Inherits formPadrao
    Private registro As New registroBO
    Public WithEvents gridLaudosSecao As New ucGridLaudos()

    Sub New()
        ' This call is required by the designer.
        InitializeComponent()

        Me.WindowState = FormWindowState.Maximized
        Me.ControlBox = False

        gridLaudosSecao.AutoScroll = False
        pnlGrid.AutoScroll = False
        generica.redimensionaControle(pnlGrid, True)
        generica.redimensionaControle(gridLaudosSecao, True)
        'gridLaudosSecao.AutoSize = True
       

    End Sub

    Private Sub principal_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        populaGrid()
    End Sub

    Private Sub populaGrid()

        Try
            ''--------------------------------------------------------------------------
            '' CARREGA OS LAUDOS DA SECAO NA QUAL O PERITO ENCONTRA-SE LOGADO
            ''---------------------------------------------------------------------------

            ' Dim gridLaudosSecao As New ucGridLaudos(registro.getLaudosSecao(frmLogin.usuarioLogado.SECAO.ID_SECAO))
            ''--------------------------------------------------------------------------
            '' Lista todos os laudos da seção por ordem decrescente
            ''---------------------------------------------------------------------------

            Me.pnlGrid.Controls.Add(gridLaudosSecao)
            gridLaudosSecao.Dock = DockStyle.Fill

        Catch ex As Exception

            '---------------------------------------------------------
            ' CHAMA A FUNÇÃO QUE IRÁ GRAVAR O ERRO NO ARQUIVO DE LOG DO SISTEMA
            '---------------------------------------------------------
            generica.gravaErro(ex)
        End Try


    End Sub

    Private Sub btnSearch_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Try
            gridLaudosSecao.populaGrid(txtSearch.Text)
        Catch ex As Exception

            generica.gravaErro(ex)

        End Try
    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click

    End Sub

    Private Sub btnAtualizar_Click(sender As Object, e As EventArgs) Handles btnAtualizar.Click
        Try
            gridLaudosSecao.populaGrid(String.Empty)
        Catch ex As Exception
            generica.gravaErro(ex)
        End Try
    End Sub
End Class

